<?php
/**
 * Created by PhpStorm.
 * User: ZCY
 * Date: 2019/1/9
 * Time: 15:16
 */
namespace api\controllers;
use yii\web\Controller;
use Yii;
class ErrorController extends Controller
{
    public function actionError()
    {
        $e = Yii::$app->errorHandler->exception;
        $errMsg = $e->getMessage();
        $errCode = $e->statusCode;
        $response = Yii::$app->response;
        $response->format = \yii\web\Response::FORMAT_JSON;
        return ['code' => $errCode, 'errMsg' => $errMsg];
    }




}